/*
 * @Author: kaikaima
 * @Date: 2020-12-09 16:33:29
 * @LastEditTime: 2020-12-26 19:59:47
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /undefined/home/messi/Data_Structure_and_Algorithm_GIT/Tree/test_RBT.cpp
 */
#include "RBT.h"

int main (int argc, char* argv[]){
    RedBlackTree<int> array(7);
    std::cout<<array.get_max()<<std::endl;
    int a[]={8, 3, 9, 5, 7, 4, 2, 6, 0, 5, 8};
    array.insert(6);
    std::cout<<array.get_min()<<std::endl;
    //加入一个待排序数组
    for(int i=0;i<11;i++){
    array.insert(a[i]);
    array.inorder_walk();}
    //输出最大值最小值
    std::cout<<array.get_max()<<std::endl;
    std::cout<<array.get_min()<<std::endl;
    //判断10是否存在
    if(array.Search(10))
    std::cout<<"10 exists";
    else
    std::cout<<"can't find 10";
    std::cout<<std::endl;
    //输出
    array.inorder_walk();
    //判断0是否存在
    if(array.Search(0))
    std::cout<<"0 exists";
    else
    std::cout<<"can't find 0";
    std::cout<<std::endl;
    //删掉8（有两个）
    array.del_data(8);
    //查找8
    if(array.Search(8))
    std::cout<<"8 exists";
    else
    std::cout<<"can't find 8";
    std::cout<<std::endl;
    //输出
    array.inorder_walk();
    //再删除8
    array.del_data(8);
    //查找8
    if(array.Search(8))
    std::cout<<"8 exists";
    else
    std::cout<<"can't find 8";
    std::cout<<std::endl;
    //输出
    array.inorder_walk();
    array.del_data(5);
    //查找5
    if(array.Search(5))
    std::cout<<"5 exists";
    else
    std::cout<<"can't find 5";
    std::cout<<std::endl;
    //输出
    array.inorder_walk();
    array.del_data(5);
    //查找5
    if(array.Search(5))
    std::cout<<"5 exists";
    else
    std::cout<<"can't find 5";
    std::cout<<std::endl;
    //输出
    array.inorder_walk();
    return 0;
}